Inside Macintosh: Macintosh Toolbox Essentials

Previous | Chapter Top | Chapter Contents | Next

FindWindow Result Codes

When your application receives a mouse event, you typically call the FindWindow function (FindWindow) . FindWindow returns an integer that specifies where the cursor was when the user pressed the mouse button.

enum {                      /* FindWindow result codes */
    inDesk          = 0,    /* none of the following */
    inMenuBar       = 1,    /* in menu bar */
    inSysWindow     = 2,    /* in desk accessory window */
    inContent       = 3,    /* anywhere in content rgn except size box
                            /* if window is active, anywhere including
                            /* size box if window is inactive */
    inDrag          = 4,    /* in drag (title bar) region */
    inGrow          = 5,    /* in size box (active window only) */
    inGoAway        = 6,    /* in close box */
    inZoomIn        = 7,    /* in zoom box (window in standard state) */
    inZoomOut       = 8     /* in zoom box (window in user state) */
};

Enumerator descriptions

inDesk
The cursor is not in the menu bar, a desk accessory window, or any window that belongs to your application. The FindWindow function (FindWindow) might return this value if, for example, the user presses the mouse button while the cursor is on the window frame but not in the title bar, close box, or zoom box. When FindWindow returns inDesk , your application doesn't need to do anything. In System 7, when the user presses the mouse button while the cursor is on the desktop or in a window that belongs to another application, the Event Manager sends your application a suspend event and switches to the Finder or another application.
inMenuBar
The user has pressed the mouse button while the cursor is in the menu bar. When FindWindow returns inMenuBar , your application typically adjusts its menus and then calls the Menu Manager's function MenuSelect to let the user choose menu items. For more on MenuSelect , see the chapter "Menu Manager Reference" in this book.
inSysWindow
The user has pressed the mouse button while the cursor is in a window belonging to a desk accessory that was launched in your application's partition. This situation seldom arises in System 7. When the user clicks in a window belonging to a desk accessory launched independently, the Event Manager sends your application a suspend event and switches to the desk accessory.
If FindWindow does return inSysWindow , your application calls the SystemClick function, described in Inside Macintosh: Macintosh Toolbox Essentials (page -31) . The SystemClick function routes the event to the desk accessory. If the user presses the mouse button with the cursor in the content region of an inactive desk accessory window, SystemClick makes the window active by sending your application and the desk accessory the appropriate activate events.
inContent
The has pressed the mouse button while the cursor is in the content area (excluding the size box in an active window) of one of your application's windows. When FindWindow (FindWindow) returns inContent , your application calls its function for handling clicks in the content region.
inDrag
The user has pressed the mouse button while the cursor is in the drag region of a window (that is, the title bar, excluding the close box and zoom box). When FindWindow returns inDrag , your application calls the Window Manager's DragWindow function (DragWindow) to let the user drag the window to a new location.
inGrow
The user has pressed the mouse button while the cursor is in an active window's size box. When FindWindow returns inGrow , your application calls its own function for resizing a window.
inGoAway
The user has pressed the mouse button while the cursor is in an active window's close box. When FindWindow returns inGoAway , your application calls the TrackGoAway function (TrackGoAway) to track mouse activity while the button is down and then calls its own function for closing a window if the user releases the button while the cursor is in the close box.
inZoomIn or inZoomOut
The user has pressed the mouse button while the cursor is in an active window's zoom box. When FindWindow returns inZoomIn or inZoomOut , your application calls the TrackBox function (TrackBox) to track mouse activity while the button is down and then calls its own function for zooming a window if the user releases the button while the cursor is in the zoom box.

© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next